const Controller = require('egg').Controller;
class HomeController extends Controller {
  async index() {
      const { ctx } = this;
      ctx.body="hi egg ~"
  }  

  async login(){
      const {ctx} = this;
      const {username,password} = ctx.request.body;
  }

  async register(){
      const {ctx} = this;
      const {username,password,nickname} = ctx.request.body;
      if(!username||!password||!nickname){
        ctx.body={
            code:400,
            msg:"缺少必须参数"
        }
        return;
    }
    //用户名不能重复
    const user = await this.service.user.findByUsername(username);
    console.log("user",user)
  }
}
module.exports = HomeController;